-- 释放可重入锁
local lockKey = KEYS[1]
local threadField = ARGV[1]
local releaseTime = ARGV[2]
-- 判断锁是否是自己的
if (redis.call('hexists', lockKey, threadField) == 0) then
    return nil
end
local count = redis.call('hincrby', lockKey, threadField, -1)
if (count > 0) then
    redis.call('expire', lockKey, releaseTime)
else
    redis.call('del', lockKey)
end
return nil
